package com.jcvision.mms.webservice;

import java.net.Inet4Address;
import java.net.UnknownHostException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.xml.ws.Endpoint;

import org.apache.log4j.Logger;

public class OrderNotifyServer extends HttpServlet {

	private static final long serialVersionUID = 1L;
	private static Logger logger = Logger.getLogger(OrderNotifyServer.class);

	@Override
	public void init() throws ServletException {
		publish();
	}
	
	public void publish() {
		String ip = "127.0.0.1";
		String port = "8082";
		try {
			ip = Inet4Address.getLocalHost().getHostAddress();
		} catch (UnknownHostException e) {
		}
		String address = "http://" + ip + ":" + port + "/WebService/OrderNotify";
		Endpoint.publish(address, new OrderNotify());
		logger.info("成功发布OrderNotify WebService,address:" + address);
	}
	
	public static void main(String[] args) throws ServletException {
//		OrderNotifyServer server = new OrderNotifyServer();
//		server.init();
	}
	
}
